package stz.flash.main.flashlight.field;

import net.rim.device.api.system.Bitmap;
import net.rim.device.api.system.Display;
import stz.flash.Info;
import stz.flash.main.ImageXY;
import stz.flash.main.state.KeyOperator;
import blackberry.util.field.DjNonHighlightBitmapField;
import blackberry.util.image.DjImageResizer;

public class FlashlightField extends HighlightManagerForFlashMode {

	private static final String FILE_NAME_OF_FLASHLIGHT = "FLASHLIGHT.png";
	
	public FlashlightField() {
		super(Info.COLOR_OF_FOCUS,
				Info.COLOR_OF_SELECT,
				Info.GLOBAL_ALPHA_OF_HIGHLIGHT, 
				null);
		add(new DjNonHighlightBitmapField(
				DjImageResizer.fitIntoDisplay(
						Bitmap.getBitmapResource(FILE_NAME_OF_FLASHLIGHT), 
						ImageXY.WIDTH_OF_TEXT_IMAGE, 
						ImageXY.HEIGHT_OF_TEXT_IMAGE, 
						ImageXY.WIDTH_OF_VIRTUAL_IMAGE, 
						ImageXY.HEIGHT_OF_VIRTUAL_IMAGE, 
						0, Bitmap.FILTER_BILINEAR),
				FOCUSABLE));
	}
	
	public int getPreferredWidth() {
		return Display.getWidth();
	}
	
	public void execute() {
		KeyOperator.runSpace();
	}
}

